<?php

// 商铺分类表

namespace app\console\model;

use think\Model;

class ShopType extends Model
{
    // 模型事件
    protected static function init()
    {
        self::event('before_insert', function ($data) {
           $data->recommend = 2;
        });


        // 写入前
        self::event('before_write', function ($data) {

            $data->picUrl = uploadImg('picUrl', 'shop');

            $data->update_time = date('Y-m-d', time());
        });
    }
}